import java.util.Arrays;
import java.util.Scanner;

class Dog {
    public String name;
    public int age;
    public String color;

   public void Wag() {
        System.out.println(name + "摇尾巴");
    }

    public Dog(String name, int age, String color) {
        this.name = name;
        this.age = age;
        this.color = color;
    }
}
public class Test {
    public static void main(String[] args) {
        Dog dog1 = new Dog();



    }
    public static void main44(String[] args) {
        int[][] array = new int[2][];
        array[0] = new int[3];
        array[1] = new int[5];
        for (int i = 0; i < array.length; i++) {
            for (int j = 0; j < array[i].length; j++) {
                System.out.print(array[i][j]+" ");
            }
            System.out.println();
        }
    }
    public static void main123(String[] args) {
      //  int[][] array1 = {1,2,3,4,5,6};

        int[][] array2 = {{1,2,3},{4,5,6}};

        for (int[] arr:array2) {
            for (int x:arr) {
                System.out.print(x+" ");
            }
            System.out.println();
        }
      /*  for (int i = 0; i < array2.length; i++) {
            for (int j = 0; j < array2[i].length; j++) {
                System.out.print(array2[i][j]+" ");
            }
            System.out.println();
        }*/

       // int[][] array3 = new int[2][3]// 默认为0




      /*  int[] array = new int[10];// 原本里面全是0
        Arrays.fill(array,0,5,10);
        System.out.println(Arrays.toString(array));*/
    }
    public static void ma11in(String[] args) {
        int[] arr1 = {1,3,5};

        int[] arr2 = {1,3,5};

        System.out.println(Arrays.equals(arr1, arr2));
    }
    public static void bubbleSort(int[] arr) {
        for (int i = 0; i < arr.length - 1 ; i++) {
            boolean flag = false;
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j+1]) {
                    int tmp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] =tmp;
                    flag = true;
                }
            }
            if (!flag) {
                return ;//说明已经有序
            }
        }
    }
    public static void m11ain(String[] args) {
        int[] arr = {9, 5, 2, 7};
        bubbleSort(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static int binarySearch(int[] array,int key) {
        int left = 0;
        int right = array.length-1;
        while (left <= right) {
            int mid = (left + right) / 2;
            if (array[mid] < key) {
                left = mid +1;
            } else if (array[mid] > key) {
                right = mid -1;
            } else {
                return mid;
            }
        }
        return -1;

    }
    public static void ma1in(String[] args) {
        int[] array = {1,3,44,11,22,145,2};
        Arrays.sort(array);
        int ret = Arrays.binarySearch(array,1);
        //找到了 ，返回它的下标  找不到返回- 1
        System.out.println(ret);
    }
    public static void mai1n(String[] args) {
        int[] array = {1,2,3,4,5,6};
        array = Arrays.copyOf(array,array.length*2);
        System.out.println(Arrays.toString(array));
    }
    public static void main22(String[] args) {
        int[] array = {1,2,3,4,5};
        int[] str = new int[array.length];
        System.arraycopy(array, 0, str, 0, array.length);
        System.out.println(Arrays.toString(str));
    }
   /* public static String myToString(int[] array) {
        //判断数组是否为空
        if (array == null) {
            return null;
        }
        String ret = "[";
        for (int i = 0; i < array.length ; i++) {
            ret += array[i];
            if (i != array.length-1) {
                ret += ", ";
            }
        }
        ret += "]";
        return  ret;
    }
    public static void main(String[] args) {
        int[] array = {1,2,3,4,5,6};
        String ret = myToString(array);
        System.out.println(ret);
    }*/
    /*public static int[] func(int[] arr) {
        for (int i = 0; i < arr.length ; i++) {
            arr[i] *= 2;
        }
        return arr;
    }
    public static void main(String[] args) {
        int[] arr = {1,3,5};
        int[] str = func(arr);
        for (int x:str) {
            System.out.print(x+" ");
        }
    }*/
    /*public static void main(String[] args) {
        int[] arr = {1, 2, 3};
        func(arr);
        System.out.println("arr[0] = " + arr[0]);
    }
    public static void func(int[] a) {
        a[0] = 10;
        System.out.println("a[0] = " + a[0]);
    }*/
        /*int[] array = {1, 2, 3};

    for(int i = 0; i < array.length; i++){
    System.out.println(array[i] + " ");}
    }*/

}
